﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AliyunOpenSearch4Net.Base;
using Newtonsoft.Json;

namespace AliyunOpenSearch4Net.App
{
    class AppCreateRequest : RequestBase<Response<AppCreateResult>>
    {
        public AppCreateRequest()
            : base("create")
        {

        }

        public string AppName { get; set; }

        public string Template { get; set; }

        protected override void RegisterQueryItems(IList<KeyValuePair<string, string>> list)
        {
            if (!string.IsNullOrEmpty(Template))
                list.Add("template", Template);

            list.Add("app_name", AppName);
        }
    }

    /// <summary>
    /// Application create result
    /// </summary>
    public class AppCreateResult
    {
        /// <summary>
        /// Gets or sets the name of the index.
        /// </summary>
        /// <value>
        /// The name of the index.
        /// </value>
        [JsonProperty("index_name")]
        public string IndexName { get; set; }
    }
}
